;;;;;;;;;;;;;;;;;;;;;;;;;; Java mode setting ;;;;;;;;;;;;;;;;;;;;;;
(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
	    (append
	     '(("\\.java\\'" . jde-mode))
	     auto-mode-alist)))
  (require 'jde))


;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
  (setq c-basic-offset 4))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)

;(setq auto-mode-alist
;      (append '(("\.java$" . java-mode)) auto-mode-alist))
(defun eip-java-mode ()
;  (setq semantic-load-turn-everything-on t)
;  (require 'semantic-load)
;  (require 'ecb)
  (setnu-mode)
  (tabbar-local-mode)
  (hs-minor-mode)
  (hl-line-mode)
;  (glasses-mode)
  (auto-fill-mode)
;  (tabbar-local-mode)
;  (c-setup-filladapt)
;  (filladapt-mode 1)
  (c-toggle-auto-hungry-state 1)
  (c-set-style "bsd")
  (setq make-backup-files t
	version-control t
	kept-old-versions 1
	kept-new-versions 5
	delete-old-versions t
	bkup-backup-directory-info '((t "~/_backups/" ok-createfull-path)))
  (setq ctypes-auto-parse-mode t)
  (setq indent-tabs-mode nil)
  (setq c-ignore-auto-fill '(string))
  (setq fill-column 80)
  (setq c-basic-offset 8)
;  (setq exec-path (cons "~/.emacs.d/XREF" exec-path))
;  (setq load-path (cons "~/.emacs.d/XREF/emacs" load-path))
;  (load "xrefactory")
;  (jde-mode)
  (define-key java-mode-map [(control \;)] 'hs-toggle-hiding)
  (define-key java-mode-map [(control meta \;)] 'hs-hide-all)
  (define-key java-mode-map [(return)] 'newline-and-indent)
  (define-key java-mode-map [(tab)] 'my-indent-or-complete)
  (define-key java-mode-map [(control backspace)] 'c-hungry-backspace)
  (define-key java-mode-map [(meta d)] 'c-hungry-delete-forward))

(add-hook 'java-mode-hook 'eip-java-mode)
